package com.cqc.jdk8.Jutil.concurrent;

import org.junit.Test;

import java.util.concurrent.TimeUnit;

public class TimeUnitTest {

    @Test
    public void f1() throws InterruptedException {
        long start = System.currentTimeMillis();
        TimeUnit.MILLISECONDS.sleep(1500);
        long end = System.currentTimeMillis();

        System.out.println(TimeUnit.MILLISECONDS.toSeconds(end - start));
    }

    @Test
    public void f2() throws InterruptedException {
        f1();
    }


    private int f3() {
        try {
            return 5 / 0;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return 5;
    }
}
